<?php

namespace app\admin\controller;
class Articlemass extends base
{
    //前置方法
    protected $beforeActionList = [
        'map'  =>  ['only'=>'index'],
    ];

    /**
     * 搜索
     */
    protected function map(){
        if ($this->request->isGet()) {
            $data = $this->request->param();
            $this->datas = array();
            if (!empty($data['start_time']) && !empty($data['end_time']) && (strtotime($data['start_time']) < strtotime($data['end_time']))) {
                $this->datas ['create_time'] = [
                    ['>', strtotime($data['start_time'])],
                    ['<', strtotime($data['end_time'])]
                ];
            }

            $this->datas ['aid'] = $data['aid'];
            $this->datas['lang'] = cookie('think_var_admin');
        }
    }

    /**
     * 查看留言
     */
    public function read($id)
    {

        $order[$this->order] = $this->sort;

        $list = db('Articlemass')->where('aid', $id)->paginate()->appends($this->request->param());

        $this->assign([
                'list' => $list,
                'num'=>db('Articlemass')->where('aid', $id)->count(),
                'addcid'=>''
            ]
        );
        return $this->fetch();
    }

}
